//
// Created by miaomiaole on 2023/5/21.
//


#include "sample_unique_prt.h"

using namespace std;

int main() {
    releas_unique_pointer();
    std::cout << "=======releas_unique_ptr========" << std::endl;
    releas_unique_ptr();

    // 定义变量名a
    int a = 10;
    // 变量a取址赋值给指针a_p
    int *a_p = &a;
    // 变量a引用赋值给 a_ref
    int &a_ref = a;
    // a_ref引用取值赋值给指针a_p_1
    int *a_p_1 = &a_ref;
    // a_p指针取值赋值给引用 a_ref_1
    int &a_ref_1 = *a_p;


    cout << "a is value: " << a << " a is prt_addr is: " << a_p << " a is value: " << a_ref << " a_ref is prt_addr is: "
         << a_p_1
         << " a_p is value: " << a_ref_1 << " a_p not equal a_p_1: " << (bool) (a_p == a_p_1) << endl;


    smart_pointer();

    Sample &ref_sample = func_ref();
    cout << "generate Sample by func_ref = " << ref_sample.content_ << endl;
    delete &ref_sample;


    cout << "================time================" << endl;

    time_time();

}